package com.hzzy.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hzzy.IDao.HzSemesterMapper;
import com.hzzy.bean.HzSemester;
import com.hzzy.bean.HzSemesterExample;
import com.hzzy.service.HzSemesterService;

@Service
public class HzSemesterServiceImpl implements HzSemesterService {
	
	@Autowired
	private HzSemesterMapper hzSemesterMapper;
	
	/**
	 * 根据班级Id返回当前学期信息 
	 * @param classId
	 * @return
	 */
	public HzSemester getHzSemesterByClassId(int classId) {
		Map<String, Object> conditions = new HashMap<String, Object>();
		conditions.put("classId", classId);
		List<HzSemester> list = hzSemesterMapper.selectByConditions(conditions);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

	public List<HzSemester> getHzSemesterList(String teacherId) {
		return hzSemesterMapper.selectByClassNoFinish(teacherId);
	}
	/**
	 * 更具学期id查询该学期详情
	 */
	public HzSemester selectSemesterBySemesterId(int semesterid) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("semesterid", semesterid);
		return hzSemesterMapper.selectSemesterBySemesterId(param);
	}
	/**
	 * 查询所有学期
	 */
	public List<HzSemester> selectAllSemester() {
		return hzSemesterMapper.selectAllSemester();
	}

}
